package gates;

import java.awt.Graphics;

import master.*;

/**
 * A gate to measure the the quantum register - will collapse it to an eigenstate
 * 
 * 
 * @author Matthew
 *
 */


public class Measure extends QuantumGate {


	
	public Measure(){
	
	}

	
	public void actOnReg(QuantumRegister register) {
		register.collapseToEigenstate();
		for(int i = 0; i < register.getDimension(); i++){
			if(register.getCoefficient(i).magnitudeFloat() != 0 ){
				System.out.println("" + i);
			}
				
		}
		
	}

	

	public int[] getActingBits() {
		int[] a = new int[1];
		a[0] = -1;
		return a;
	}

	
	

}
